<!DOCTYPE html>
<!--[if IE 8]> <html lang="zh-CN" class="ie8"> <![endif]-->
<html lang="zh-CN">

	<head>
		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
		<title></title>
		<meta content="telephone=no,email=no,address=no" name="format-detection" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<meta name="msapplication-tap-highlight" content="no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="wap-font-scale" content="no">
		<meta name="Keywords" content="" />
		<meta name="Description" content="" />

		<link rel="stylesheet" href="/themes/wnsc_moblie/newMobile/User/css/common.css" />
		<link rel="stylesheet" href="/themes/wnsc_moblie/newMobile/User/css/user.css" />
		<link rel="stylesheet" href="/themes/wnsc_moblie/newMobile/User/css/color-style.css" />
		<link rel="stylesheet" type="text/css" href="/themes/wnsc_moblie/Public/css/public.css">
		<link rel="stylesheet" href="/themes/wnsc_moblie/newMobile/Shop/css/dropload.css" />
		<script type="text/javascript" src="/themes/wnsc_moblie/newMobile/User/js/area/jquery.min.js"></script>
		<script type="text/javascript" src="/themes/wnsc_moblie/Public/js/common.js"></script>
		<script src="/themes/wnsc_moblie/newMobile/Shop/css/dropload.js"></script>
		<script src="/themes/wnsc_moblie/newMobile/Shop/js/layer.js"></script>
		<link rel="stylesheet" type="text/css" href="/themes/wnsc_moblie/newMobile/Shop/css/group_detail_new.css"/>
		<link rel="stylesheet" href="/themes/wnsc_moblie/newMobile/Shop/css/goods.css" />
		<script src="/themes/wnsc_moblie/newMobile/Shop/js/goods.js"></script>
	</head>

	<body>

		<header>
			<div class="tab_nav">
				<div class="header">
					<div class="header-left">
						<a class="sb-back" href="javascript:history.back(-1)" title="返回"></a>
					</div>
					<div class="header-middle">拼团</div>
					<div class="header-right">
						<aside class="show-menu-btn" style="float:right;">
							<div class="show-menu" id="show_more">
								<a href="javascript:void(0)"></a>
							</div>
						</aside>
					</div>
				</div>
			</div>
		</header>
		<php>
			if($order_info['tuan_is_first_id']==0){ 
				$num=get_tuan($order_info['order_id']); 
			}else{ 
				$num=get_tuan($order_info['tuan_is_first_id']); 
			} 
		</php>
		<mtc_include file="Public:right_nav" />
		<div class="order-box">
			<section id="dealInfo-first" class="dealInfo" >
				<div class="p">
					<img class="p_pic" src="{$order_good.goods_image}">
				</div>
				<div class="d">
					<h3 class="d_tit">
			            {$order_good.goods_name}
			          </h3>
					<p class="d_info">
						<em><span class="tuanNum">{$order_info['tuannum']}人团：</span><span class="tuanPrice">¥<strong><span id="tuanPrice">{$shop_info.tuan_price}</span>/件</strong></span><span class="org">¥<em>{$shop_info.price}</em></span>
						</em>
					</p>
					<p><span class="mark">拼团多省<em>{$shop_info['price']-$shop_info['tuan_price']}</em>元</span><span class="lu_ru js_luru_btn">活动规则</span></p>
				</div>

			</section>
			<div class="tuanBox itemMode">
				<php>if($num==$order_info['tuannum']){</php>
				<i class="status success"></i>
				<php>}</php>
				<section class="groupUserimg">
					<i class="userImg head">
						<img src="/themes/wnsc_moblie/newMobile/Shop/images/tz.png">
					</i>
					<php>for($i=1;$i<$num;$i++){</php>
					<i class="userImg ">
						<img src="/themes/wnsc_moblie/newMobile/Shop/images/cy.png">
					</i>
					<php>}</php>
					
				</section>
			
				<section class="centerRemind btn-downapp js-btn-downapp">
					<php>if($num==$order_info['tuannum']){</php>
						<p>拼团成功~</p>
					<php>}else{</php>
						<p>还差<span class="num1" style="color: red;">{$order_info['tuannum']-$num}</span>人，快去邀请好友参团吧</p>
					<php>}</php>
				</section>
					<php>if($num==$order_info['tuannum']){</php>
						<div class="btn-goindex" onclick='location="/"'>去首页逛逛</div>
					<php>}else{</php>
						<div class="btn-goindex" onclick="select_spec('kaituan')">一键成团</div>
					<php>}</php>
				

				<!-- 附近的团 -->

			</div>
			
			<div class="like_list">
				<div class="hot_products" data-search-count="300">
					<div class="title"><span></span></div>
					<div class="hot_box">
						<foreach name="like_list" item="v">
							<php>$rs=shop_type($v['id']);</php>
						<div class="hot-list deal"  onclick='location.href="{:U('shop/index',array('id'=>$v['id']))}"'>
							<div class="l"> <img style="width:197px;height:197px" src="{$v.image}" class="newImg">
								<php>if($rs['tuan']==1){</php><img src="/static/images/tuan.png" alt="此商品参与团购" style="position: absolute;z-index: 999;width: auto; height: auto;left:0px;"><php>}</php>
								<p class="txt"><php>if($rs['coupon']==1){</php><em style="background-image: url('/static/images/yhq.png');padding: 0 5px 0 11px;color: #fff;background-size: 100% 100%;margin-right: 5px;">优惠券</em><php>}</php>{$v.title}</p>
								<div class="btm clear">
									<div class="price-g"> <em>￥</em> <span class="y">{$v.price}</span>  </div>  </div>
								<div class="sales_block clear">
								<span class="sales">已售{$v.sale_num}件</span> </div>
							</div>
						</div>
						</foreach>
					</div>
				</div>

			</div>
			<!-- 购物车弹出代码-->
			<section class="f-block spec-menu-hide" id="choose_attr">
				<div class="f-title-attr clearfix">

					<div class="spec-pic">
						<img class="SZY-GOODS-IMAGE-THUMB" src="{$shop_info.image}">
					</div>
					<div class="f-title-arr-right">

						<span class="goodprice SZY-GOODS-PRICE price-color" style="float: left;width: auto;">￥{$shop_info.price} </span> <em style="color: #f60;float: left;line-height: 20px;border: 1px solid;padding: 0 2px;border-radius: 5px;margin-left: 11px;">拼团价￥{$shop_info.tuan_price}</em>
						<span class="SZY-GOODS-NUMBER">库存{$shop_info.num}件</span>

					</div>
					<a class="c-close-attr" href="javascript:close_choose_spec()"></a>
				</div>
				<div class="f-content-attr">
					<ul class="navContent choose" style="display: block;">
						<!-- 产品规格 -->
						<php>if($shop_info['shop_sku']['SKU_Style']){</php>
						<li>
							<div class="title">颜色</div>
							<div class="item attr SKU_Style">
								<!--属性选中状态-->
								<foreach name="shop_info['shop_sku']['SKU_Style']" item="v">
									<a class="goods-style-item <eq name='key' value='0'>hover</eq>" data="{$v.SKU_ThumbImg_M}" href="javascript:void(0);">{$v.modifyValue}</a>
								</foreach>
							</div>
						</li>
						<php>}</php>
						<php>if($shop_info['shop_sku']['SKU_Spec']){</php>
						<li>
							<div class="title">规格</div>
							<div class="item attr SKU_Spec">
								<foreach name="shop_info['shop_sku']['SKU_Spec']" item="v">
									<a class="goods-spec-item <eq name='key' value='0'>hover</eq>" data="{$v.modifyValue}" href="javascript:void(0);">{$v.modifyValue}</a>
								</foreach>
							</div>
						</li>
						<php>}</php>
						<li>
							<div class="title1">购买数量</div>
							<div class="item1">
								<div class="goods-num amount amount-btn cart-box">
									<i class="decrease amount-minus iconfont">&#xe652;</i>
									<input type="text" class="amount-input num" value="1" data-amount-max="0" maxlength="8" title="请输入购买量" onFocus="this.blur()">
									<i class="increase amount-plus iconfont">&#xe653;</i>
								</div>
							</div>
						</li>
					</ul>

					<div style="height: 10px"></div>
				</div>
				<div class="f-foot">

					<a href="javascript:void(0)" class="SZY-BUY-BUTTON bg-color">确定</a>

				</div>
			</section>

			<section class="mask-div" style="display: none;"></section>
		<script type="text/javascript">
			$(function(){
				get_attr()
				$('.goods-style-item').click(function() {
					var img = $(this).attr('data');
					if(img) {
						$('.SZY-GOODS-IMAGE-THUMB').attr('src', img);
					}
					$(this).siblings().removeClass('hover');
					$(this).addClass('hover');
					get_attr()
				})

				$('.goods-spec-item ').click(function() {
					$(this).siblings().removeClass('hover');
					$(this).addClass('hover');
					get_attr()
				})
			$(".amount-input").attr("data-amount-min", 1);
			$(".amount-minus").click(function() {
				var amount_input=$('.amount-input').val();
				if((parseInt(amount_input)-1)<=0){
					$('.amount-input').val(1)
				}else{
					$('.amount-input').val(amount_input-1)
				}
			})
			$(".amount-plus").click(function() {
				var amount_input=$('.amount-input').val();
				$('.amount-input').val(parseInt(amount_input)+1)
			})
			$('.SZY-BUY-BUTTON').click(function() {
					var yanse = $('.SKU_Style .hover').html();
					var guige = $('.SKU_Spec .hover').attr('data');
					var num = $('.goods-num .num').val();
					var id = "{$shop_info['id']}";
				
					var stock_num=$('.SZY-GOODS-NUMBER').html();
					var stock_num=stock_num.replace('库存','');
					var stock_num=stock_num.replace('件','');
					var stock_num=parseInt(stock_num);
					var ctuan_id={$tuan_is_first_id};
					if(stock_num<num){
						layer.msg('库存不足！');
						return;
					}
					$.post('/cart/add_cart', {
						id: id,
						yanse: yanse,
						guige: guige,
						num: num,
						ctuan_id:ctuan_id,
						type:1,
						buygood:1,
					}, function(result) {
						if(result.code == 1) {
							buy_now();
						}else{
							layer.msg(result.message);
						}
					}, "json");
				})

			})
			//获取属性值
		var sku = {:json_encode($shop_info['shop_sku']['SKU_Form'])};
		function get_attr() {
			if($('.SKU_Style .hover')){
				var SKU_Style = $('.SKU_Style .hover').html();
			}else{
				var SKU_Style =null;
			}
			if($('.SKU_Spec .hover')){
				var SKU_Spec = $('.SKU_Spec .hover').html();
			}else{
				var SKU_Spec=null;
			}
			if(sku){
				$.each(sku, function() {
					if(SKU_Style&&SKU_Spec){
						if($(this)[0].sku_spec == SKU_Spec && $(this)[0].sku_style == SKU_Style) {
							var attr_price = $(this)[0].sku_price;
							var attr_stock = $(this)[0].sku_stock;
							attr_price=toDecimal2(attr_price);
							$('.SZY-GOODS-PRICE').html('￥' + attr_price);
							$('.SZY-GOODS-NUMBER').html('库存' + attr_stock + '件');
						}
					}else if(SKU_Style){
						if($(this)[0].sku_style == SKU_Style) {
							var attr_price = $(this)[0].sku_price;
							var attr_stock = $(this)[0].sku_stock;
							attr_price=toDecimal2(attr_price);
							$('.SZY-GOODS-PRICE').html('￥' + attr_price);
							$('.SZY-GOODS-NUMBER').html('库存' + attr_stock + '件');
						}
					}else if(SKU_Spec){
						if($(this)[0].sku_spec == SKU_Spec) {
							var attr_price = $(this)[0].sku_price;
							var attr_stock = $(this)[0].sku_stock;
							attr_price=toDecimal2(attr_price);
							$('.SZY-GOODS-PRICE').html('￥' + attr_price);
							$('.SZY-GOODS-NUMBER').html('库存' + attr_stock + '件');
						}
					}
					
					
				});
			}
		
			

		}
		function toDecimal2(x) {    
	        var f = parseFloat(x);    
	        if (isNaN(f)) {    
	            return false;    
	        }    
	        var f = Math.round(x*100)/100;    
	        var s = f.toString();    
	        var rs = s.indexOf('.');    
	        if (rs < 0) {    
	            rs = s.length;    
	            s += '.';    
	        }    
	        while (s.length <= rs + 2) {    
	            s += '0';    
	        }    
	        return s;    
	    }
		function buy_now() {
				$.post('/pay/buy_now', {}, function(result) {
					if(result.code == 1) {
						self.location = '/pay/paymentOrder';
					}
					if(result.code == 2) {
						self.location = '/user/login';
					}
					layer.msg(result.message);
				}, "json");
			}
		</script>
	
	</body>

</html>